import Vue from 'vue';
import Vuex from 'vuex';
//import "babel-polyfill";

Vue.use(Vuex);

const store = new Vuex.Store({
  // 定义状态
  state: {
  	headerLogo:require("../img/logo.png"),
  	helpShow:false,  //页面右上角帮助按钮
    headFold: true,
    modifynum:'',
    showDialog:'close',
    fundNum:'',
    docListCode:'kael',
    docPlaceCode:'kael',
    notReadSumCount:'0',//主页右上角未读公告总数量
    systemNotReadCount:'0',//主页右上角未读系统公告总数量
    shengjiNotReadCount:'0',//主页右上角未读升级公告总数量
    page:{
    	pageNo:1,  //当前页码
    	pageSize:10,  //每页条数
    	recordCount:"0",  //数据总条数
    	recordCountNo:"0",  //数据起始条
    	totalPage:"0",  //总页数
    	pageSizeOptions:[10, 20, 30],  //每页显示条数选项
    	url:""  //接口地址
    }
  },
  mutations:{
  	newHelpShow(state,msg){
  		state.helpShow = msg
  	},
  	newHeaderLogo(state,msg){
  		state.headerLogo = msg
  	},
  	newHeadFold(state,msg){
  		state.headFold = msg
  	},
  	newPage(state,msg){
  		state.page.pageNo = (msg.pageNo==""||msg.pageNo)?msg.pageNo:1;
  		state.page.pageSize = (msg.pageSize==""||msg.pageSize)?msg.pageSize:10;
  		state.page.recordCount = (msg.recordCount==""||msg.recordCount)?msg.recordCount:"0";
  		state.page.recordCountNo = (msg.recordCountNo==""||msg.recordCountNo)?msg.recordCountNo:"0";
  		state.page.totalPage = (msg.totalPage==""||msg.totalPage)?msg.totalPage:"0";
  		state.page.pageSizeOptions = (msg.pageSizeOptions==""||msg.pageSizeOptions)?msg.pageSizeOptions:[10, 20, 30,100,500];
  		state.page.url = (msg.url==""||msg.url)?msg.url:"";
  	},
  	modifydata(state,msg){
  		state.modifynum=msg;
  	},
  	newShowDialog(state,msg){
  		state.showDialog = msg
  	},
    goFundData(state,msg){        //账户资金到资金明细的数据传输
  	  state.fundNum = msg
    },
		newDocListCode(state,msg){  //主页头部右上角公告
  		state.docListCode=msg
  	},
  	newDocPlaceCode(state,msg){  //主页头部右上角公告
  		state.docPlaceCode=msg
  	},
  	notReadSumCount(state,msg){  //主页头部右上角未读公告提醒
  		state.notReadSumCount=msg
  	},
  	systemNotReadCount(state,msg){  //主页头部右上角未读系统公告提醒
  		state.systemNotReadCount=msg
  	},
  	shengjiNotReadCount(state,msg){  //主页头部右上角未读升级公告提醒
  		state.shengjiNotReadCount=msg
  	},
  }
});

export default store;
